def hanoi(n,A,B,C):
    if n==0:
        return
    # 将n-1个盘子从A移到B
    hanoi(n-1,A,C,B)
    # 将第n个盘子从A移到C
    print("{} -> {}".format(A,C))
    # 将n-1 个盘子从B移到C
    hanoi(n-1,B,A,C)

hanoi(3,"A","B","C")